package testpakke;

import java.util.ArrayList;

import player.PlayerCharacter;
import player.PlayerClass;
import player.PlayerClasses;
import player.Race;
import player.Races;
import powers.Power;
import powers.ThePowers;
import virtualTabletop.Die;
import virtualTabletop.Position;
import virtualTabletop.VirtualTabletop;
import Items.TheWeapons;
import Items.Weapon;
import abilities.Abilities;
import character.Alignment;
import character.Character;
import feats.Feat;

/**
 * Test package. Nothing to see here.
 * 
 * @author bjo013
 * 
 */
public class TestMain
{

	public static void main(String[] args)
	{
		VirtualTabletop tabletop = new VirtualTabletop();

		System.out.print(tabletop.getRoundlist().get(0));

	}

	public static void attack(Character attacker, Character defender)
	{
		Power attackPower = attacker.getPowers().get(0);

		int attack = Die.d20.roll()
				+ attacker.getStatMod(attackPower.attackWith());
		int defense = defender.getDefense(attackPower.defenseAgainst());

		System.out.println(attacker.getName() + " attacks "
				+ defender.getName() + ".");
		System.out.println(attacker.getName() + " rolls " + attack
				+ " against " + defender.getName() + "s " + defense + ".");

		if (attack >= defense)
		{
			int dmg = attackPower.rollDamage(attacker.getWeapon(), attacker
					.getStatMod(attackPower.attackWith()));
			int defenderHp = defender.takeDamage(dmg);
			System.out.println(attacker.getName() + " does " + dmg
					+ " in damage to " + defender.getName() + ".\n"
					+ defender.getName() + " got " + defenderHp
					+ " hit points left.\n");
		}
		else
		{
			System.out.println(attacker.getName() + " misses!\n");
		}

		if (defender.getHP() <= 0)
		{
			defender.setDead();
			System.out.print(defender.getName() + " died!");
		}
	}

	public static Character createCharacter()
	{
		/*
		 * Scanner tastatur = new Scanner(System.in);
		 * 
		 * System.out.println("What is your name?: "); String playerName =
		 * tastatur.nextLine();
		 * 
		 * System.out.println("What do you call your character?: "); String
		 * charName = tastatur.nextLine();
		 * 
		 * System.out.println("Choose your class: "); PlayerClass playerClass =
		 * new PlayerClass(ClassName.valueOf(tastatur.next()));
		 * 
		 * System.out.println("Choose your race: "); Race dwarf = new
		 * Race(Races.valueOf(tastatur.next()));
		 */

		String playerName = new String();
		PlayerClass playerClass = PlayerClasses.fighter;
		Race race = Races.dwarf;
		String charName = race.getRace().toString() + " "
				+ playerClass.getClassName().toString();

		Abilities abilities = new Abilities(16, 16, 13, 10, 14, 11);

		int[] AC = { 10, 7 };
		int[] Fort = { 10, 5 };
		int[] Ref = { 10, 1 };
		int[] Will = { 10, 2 };

		Weapon sword = TheWeapons.longsword;

		ArrayList<Power> powers = new ArrayList<Power>();

		ArrayList<Feat> feats = new ArrayList<Feat>();

		powers.add(ThePowers.meleeBasicAttack);

		Position pos1 = new Position(0, 0);

		PlayerCharacter player = new PlayerCharacter(1, playerClass, race,
				abilities, AC, Fort, Ref, Will, powers, 1, 1,
				Alignment.LawfulGood, feats, charName, playerName,
				"Some random data", sword, pos1,
				"virtualTabletop/gfx/student.png");

		return player;
	}
}
